// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: '2024-04-03',
  devtools: { enabled: true },

  // 模块配置
  modules: [
    '@nuxtjs/tailwindcss',
    '@nuxtjs/color-mode',
    '@pinia/nuxt',
    '@vueuse/nuxt',
    '@nuxt/icon',
  ],

  // 应用配置
  app: {
    head: {
      title: 'DevToolsNav - 开发者工具导航',
      meta: [
        { charset: 'utf-8' },
        { name: 'viewport', content: 'width=device-width, initial-scale=1' },
        { 
          name: 'description', 
          content: '精选开发者工具导航平台，发现最好用的开发工具，提升开发效率' 
        },
        { 
          name: 'keywords', 
          content: '开发者工具,开发工具导航,编程工具,AI工具,开发效率,开发资源,DevToolsNav' 
        },
        // Open Graph
        { property: 'og:type', content: 'website' },
        { property: 'og:site_name', content: 'DevToolsNav' },
        { property: 'og:title', content: 'DevToolsNav - 开发者工具导航' },
        { property: 'og:description', content: '精选开发者工具导航平台，发现最好用的开发工具，提升开发效率' },
        { property: 'og:image', content: '/og-image.png' },
        // Twitter Card
        { name: 'twitter:card', content: 'summary_large_image' },
        { name: 'twitter:title', content: 'DevToolsNav - 开发者工具导航' },
        { name: 'twitter:description', content: '精选开发者工具导航平台，发现最好用的开发工具，提升开发效率' },
        { name: 'twitter:image', content: '/og-image.png' },
        // 其他
        { name: 'theme-color', content: '#4F46E5' },
        { name: 'author', content: 'DevToolsNav' },
      ],
      link: [
        { rel: 'icon', type: 'image/svg+xml', href: '/favicon.svg' },
        { rel: 'shortcut icon', href: '/favicon.svg' },
        { rel: 'apple-touch-icon', sizes: '180x180', href: '/favicon.svg' },
        { rel: 'canonical', href: 'https://devtoolsnav.com' }
      ]
    },
  },

  // 运行时配置
  runtimeConfig: {
      public: {
        // 生产环境配置
        apiBase: process.env.NUXT_PUBLIC_API_BASE || '/api',
        siteUrl: process.env.NUXT_PUBLIC_SITE_URL || 'https://devtoolsnav.com',
      },
  },

  // 颜色模式配置
  colorMode: {
    classSuffix: '',
    preference: 'light',
    fallback: 'light',
  },

  // CSS 配置
  css: [
    '~/assets/css/main.css',
  ],

  // TypeScript 配置
  typescript: {
    strict: true,
    typeCheck: true,
  },

  // Nitro 配置
  nitro: {
    preset: 'node-server',
  },

  // 性能优化
  experimental: {
    payloadExtraction: false,
  },

  // 构建优化
  build: {
    transpile: ['marked'],
  },
})

